<template>
  <div class="app-container">
    <div v-if="userInfo">
      <el-row :gutter="20">
        <el-col :span="6" :xs="24">
          <user-card :userInfo="userInfo" />
        </el-col>
        <el-col :span="18" :xs="24">
          <el-card>
            <el-tabs v-model="activeTab">
              <el-tab-pane label="我看过谁" name="timeline">
                <my-view />
              </el-tab-pane>
              <el-tab-pane label="黑名单" name="balicklist">
                <blacklist />
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>

      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import UserCard from '../profile/components/UserCard'
import MyView from '../profile/components/MyView'
import Blacklist from '../profile/components/Blacklist'

import {
  getUserInfo
} from '@/api/user'

export default {
  name: 'Info',
  components: { UserCard, MyView, Blacklist },
  data() {
    return {
      activeTab: 'timeline',
      userInfo: {}
    }
  },
  computed: {
    ...mapGetters([
      'username',
      'avatar',
      'employerId'
    ])
  },
  created() {
    this.getUserInfo()
  },
  methods: {
    // 获取用户信息
    getUserInfo() {
      var param = { employerId: this.employerId }
      // 获取个人信息
      getUserInfo(param).then(
        (response) => {
          // console.log(response)
          this.userInfo = response.data
          // this.userInfo.personalInfo = response.data
        }
      )
    }
  }
}
</script>
